#pragma once
#ifndef YOLACT_H_
#define YOLACT_H_
#include <vector>
#include <string>
#include <opencv2/opencv.hpp>

enum PlatForm {
   PlatForm_CPU = 0,
   PlatForm_GPU_INTEL_Integrated = 1,
   PlatForm_GPU_NVDIA_Integrated = 2,
   PlatForm_GPU_AMD_Integrated = 3,
   PlatForm_GPU_INTEL_Discrate = 4,
   PlatForm_GPU_NVDIA_Discrate = 5,
   PlatForm_GPU_AMD_Discrate = 6,
   PlatForm_GPU_CUDA = 7
};

class Yolact {
private:
   unsigned short mTargetSize;
   float* mMEANS;
   float* mSTD;
   float mConfidenceThreshold;
   float mNMSThreshold;
   int mKeepTopK;
   int* mConvWs;
   int* mConvHs;
   float* mAspectRatio;
   float* mScales;
   float* mVar;
   unsigned short mMaskHeight;
   unsigned short mMaskWidth;
   unsigned short mNumPriors;
   float* mPriorbox;
   cv::dnn::Net mNet;
   std::vector<std::string> mClassNames;
public:
   Yolact();
   ~Yolact();
   bool init(float confidenceThreshold, float NMSThreshold, const char* modelPath, PlatForm platForm = PlatForm_CPU, const int keepTopK = 200);
   void detect(cv::Mat& srcimg);
private:
   void normalize(cv::Mat& img);
   void sigmoid(cv::Mat& out, int length);
};

#endif // !YOLACT_H_

